package com.xbongbong.saas.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.paas.enums.PlatFormEnum;
import com.xbongbong.pro.enums.permission.enums.ProPermissionAliasEnum;
import com.xbongbong.saas.constant.BasicConstant;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Set;

/**
 * saas详情页工作流操作
 *
 * @author haibin.zhang
 * @version v1.0
 * @date 2019/1/25 19:12
 * @since v1.0
 */
@Getter
public enum WorkFlowEnum {
    // 详情页工作流
    CUSTOMER_COPY(RedundantTemplateTypeEnum.CUSTOMER.getCode(), "customerCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.CUSTOMER_ADD.getAlias(), BasicConstant.ZERO),
    CUSTOMER_CONTACT(RedundantTemplateTypeEnum.CUSTOMER.getCode(), "contact", "enum.workFlow.value.customer_contact", "new", XbbRefTypeEnum.CONTACT.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.CONTACT_ADD.getAlias(), BasicConstant.ONE),
    CUSTOMER_CONTRACT(RedundantTemplateTypeEnum.CUSTOMER.getCode(), "contract", "enum.workFlow.value.customer_contract", "new", XbbRefTypeEnum.CONTRACT.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.CONTRACT_ADD.getAlias(), BasicConstant.ONE),
    CUSTOMER_INVOICE(RedundantTemplateTypeEnum.CUSTOMER.getCode(), "invoice", "enum.workFlow.value.customer_invoice", "new", XbbRefTypeEnum.INVOICE.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.INVOICE_ADD.getAlias(), BasicConstant.ONE),
    CUSTOMER_OPPORTUNITY(RedundantTemplateTypeEnum.CUSTOMER.getCode(), "opportunity", "enum.workFlow.value.customer_opportunity", "new", XbbRefTypeEnum.SALES_OPPORTUNITY.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.OPPORTUNITY_ADD.getAlias(), BasicConstant.ONE),
    CUSTOMER_QUOTATIO(RedundantTemplateTypeEnum.CUSTOMER.getCode(), "quotation", "enum.workFlow.value.customer_quotatio", "new", XbbRefTypeEnum.QUOTATION.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.QUOTATION_ADD.getAlias(), BasicConstant.ONE),
    CUSTOMER_PUSH_NOTIFY(RedundantTemplateTypeEnum.CUSTOMER.getCode(), "pushNotify", "enum.workFlow.value.customer_push_notify", "new", XbbRefTypeEnum.PUSH_NOTIFY.getCode(), PlatFormEnum.WEB, null, BasicConstant.ZERO),
    CUSTOMER_REMIND(RedundantTemplateTypeEnum.CUSTOMER.getCode(), "remind", "enum.workFlow.value.customer_remind", "new", XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getCode(), PlatFormEnum.WEB, ProPermissionAliasEnum.CUSTOMER_COMMUNICATE_ADD.getAlias(), BasicConstant.ONE),
    CUSTOMER_WORK_ORDER(RedundantTemplateTypeEnum.CUSTOMER.getCode(), "workOrder", "enum.workFlow.value.customer_work_order", "new", XbbRefTypeEnum.WORK_ORDER.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.WORK_ORDER_ADD.getAlias(), BasicConstant.ONE),
    CUSTOMER_ARCHIVED(RedundantTemplateTypeEnum.CUSTOMER.getCode(), "archived", "enum.workFlow.value.customer_archived", "set", XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.CUSTOMER_ARICHIVE.getAlias(), BasicConstant.ZERO),
    CUSTOMER_CANCEL_ARCHIVED(RedundantTemplateTypeEnum.CUSTOMER.getCode(), "cancelArchived", "enum.workFlow.value.customer_cancel_archived", "set", XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.CUSTOMER_ARICHIVE.getAlias(), BasicConstant.ZERO),
    CUSTOMER_BACK_SEA(RedundantTemplateTypeEnum.CUSTOMER.getCode(), "backSea", "enum.workFlow.value.customer_back_sea", "set", XbbRefTypeEnum.CUSTOMER_PUBLIC.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.CUSTOMER_BACK.getAlias(), BasicConstant.ONE),
    CUSTOMER_SEND_TO_STAFF(RedundantTemplateTypeEnum.CUSTOMER.getCode(), "sendToStaff", "enum.workFlow.value.customer_send_to_staff", "set", XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode(), PlatFormEnum.DINGTALK, null, BasicConstant.ZERO),
    CUSTOMER_PAYMENT(RedundantTemplateTypeEnum.CUSTOMER.getCode(),"payment","enum.workFlow.value.customer_payment","new",XbbRefTypeEnum.PAYMENT.getCode(),PlatFormEnum.ALL,ProPermissionAliasEnum.PAYMENT_ADD.getAlias(), BasicConstant.ONE),
    CUSTOMER_PAYMENT_SHEET(RedundantTemplateTypeEnum.CUSTOMER.getCode(),"paymentSheet","enum.workFlow.value.customer_payment_sheet","new",XbbRefTypeEnum.PAYMENT_SHEET.getCode(),PlatFormEnum.ALL,ProPermissionAliasEnum.PAYMENT_SHEET_ADD.getAlias(), BasicConstant.ONE),
    CUSTOMER_WORK_ORDER_V2(RedundantTemplateTypeEnum.CUSTOMER.getCode(),"workOrderV2","enum.workFlow.value.customer_work_order_v2","new",XbbRefTypeEnum.WORK_ORDER_V2.getCode(),PlatFormEnum.ALL,ProPermissionAliasEnum.WORK_ORDER_V2_ADD.getAlias(), BasicConstant.ONE),

    CONTACT_COPY(RedundantTemplateTypeEnum.CONTACT.getCode(), "contactCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.CONTACT.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.CONTACT_ADD.getAlias(), BasicConstant.ZERO),
    CONTACT_OPPORTUNITY(RedundantTemplateTypeEnum.CONTACT.getCode(), "opportunity", "enum.workFlow.value.contact_opportunity", "new", XbbRefTypeEnum.SALES_OPPORTUNITY.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.OPPORTUNITY_ADD.getAlias(), BasicConstant.ONE),
    CONTACT_CONTRACT(RedundantTemplateTypeEnum.CONTACT.getCode(), "contact", "enum.workFlow.value.contact_contract", "new", XbbRefTypeEnum.CONTRACT.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.CONTRACT_ADD.getAlias(),BasicConstant.ONE),

    OPPORTUNITY_COPY(RedundantTemplateTypeEnum.SALES_OPPORTUNITY.getCode(), "opportunityCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.SALES_OPPORTUNITY.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.OPPORTUNITY_ADD.getAlias(), BasicConstant.ZERO),
    OPPORTUNITY_ARCHIVED(RedundantTemplateTypeEnum.SALES_OPPORTUNITY.getCode(), "archived", "enum.workFlow.value.opportunity_archived", "set", XbbRefTypeEnum.SALES_OPPORTUNITY.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.OPPORTUNITY_ARCHIVE.getAlias(), BasicConstant.ZERO),
    OPPORTUNITY_CANCEL_ARCHIVED(RedundantTemplateTypeEnum.SALES_OPPORTUNITY.getCode(), "cancelArchived", "enum.workFlow.value.opportunity_cancel_archived", "set", XbbRefTypeEnum.SALES_OPPORTUNITY.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.OPPORTUNITY_ARCHIVE.getAlias(), BasicConstant.ZERO),
    OPPORTUNITY_REMIND(RedundantTemplateTypeEnum.SALES_OPPORTUNITY.getCode(), "remind", "enum.workFlow.value.opportunity_remind", "new", XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getCode(), PlatFormEnum.WEB, ProPermissionAliasEnum.CUSTOMER_COMMUNICATE_ADD.getAlias(), BasicConstant.ZERO),
    OPPORTUNITY_WORK_ORDER(RedundantTemplateTypeEnum.SALES_OPPORTUNITY.getCode(), "workOrder", "enum.workFlow.value.opportunity_work_order", "new", XbbRefTypeEnum.WORK_ORDER.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.WORK_ORDER_ADD.getAlias(), BasicConstant.ONE),
    OPPORTUNITY_PUSH_NOTIFY(RedundantTemplateTypeEnum.SALES_OPPORTUNITY.getCode(), "pushNotify", "enum.workFlow.value.opportunity_push_notify", "new", XbbRefTypeEnum.PUSH_NOTIFY.getCode(), PlatFormEnum.WEB, null, BasicConstant.ZERO),
    OPPORTUNITY_CONTRACT(RedundantTemplateTypeEnum.SALES_OPPORTUNITY.getCode(), "contract", "enum.workFlow.value.opportunity_contract", "new", XbbRefTypeEnum.CONTRACT.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.CONTRACT_ADD.getAlias(), BasicConstant.ONE),
    OPPORTUNITY_QUOTATION(RedundantTemplateTypeEnum.SALES_OPPORTUNITY.getCode(), "quotation", "enum.workFlow.value.opportunity_quotation", "new",
            XbbRefTypeEnum.QUOTATION.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.QUOTATION_ADD.getAlias(), BasicConstant.ONE),

    CONTRACT_COPY(RedundantTemplateTypeEnum.CONTRACT.getCode(), "contractCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.CONTRACT.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.CONTRACT_ADD.getAlias(), BasicConstant.ZERO),
    CONTRACT_ARCHIVED(RedundantTemplateTypeEnum.CONTRACT.getCode(), "archived", "enum.workFlow.value.contract_archived", "set", XbbRefTypeEnum.CONTRACT.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.CONTRACT_ARCHIVE.getAlias(), BasicConstant.ZERO),
    CONTRACT_CANCEL_ARCHIVED(RedundantTemplateTypeEnum.CONTRACT.getCode(), "cancelArchived", "enum.workFlow.value.contract_cancel_archived", "set", XbbRefTypeEnum.CONTRACT.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.CONTRACT_ARCHIVE.getAlias(), BasicConstant.ZERO),
    CONTRACT_PUSH_NOTIFY(RedundantTemplateTypeEnum.CONTRACT.getCode(), "pushNotify", "enum.workFlow.value.contract_push_notify", "new", XbbRefTypeEnum.PUSH_NOTIFY.getCode(), PlatFormEnum.WEB, null, BasicConstant.ZERO),
    CONTRACT_INVOICE(RedundantTemplateTypeEnum.CONTRACT.getCode(), "invoice", "enum.workFlow.value.contract_invoice", "new", XbbRefTypeEnum.INVOICE.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.INVOICE_ADD.getAlias(), BasicConstant.ONE),
    CONTRACT_REFUND(RedundantTemplateTypeEnum.CONTRACT.getCode(), "refund", "enum.workFlow.value.contract_refund", "new", XbbRefTypeEnum.REFUND.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.REFUND_ADD.getAlias(), BasicConstant.ONE),
    CONTRACT_WORK_ORDER(RedundantTemplateTypeEnum.CONTRACT.getCode(), "workOrder", "enum.workFlow.value.contract_work_order", "new", XbbRefTypeEnum.WORK_ORDER.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.WORK_ORDER_ADD.getAlias(), BasicConstant.ONE),
    CONTRACT_OUTSTOCK(RedundantTemplateTypeEnum.CONTRACT.getCode(), "outstock", "enum.workFlow.value.contract_outstock", "new", XbbRefTypeEnum.CONTRACT_OUTSTOCK.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.CONTRACT_OUTSTOCK_ADD.getAlias(), BasicConstant.ONE),
    CONTRACT_PURCHASE(RedundantTemplateTypeEnum.CONTRACT.getCode(), "purchase", "enum.workFlow.value.contract_purchase", "new", XbbRefTypeEnum.PURCHASE.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.PURCHASE_ADD.getAlias(), BasicConstant.ZERO),
    CONTRACT_REMIND(RedundantTemplateTypeEnum.CONTRACT.getCode(), "remind", "enum.workFlow.value.contract_remind", "new", XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getCode(), PlatFormEnum.WEB, ProPermissionAliasEnum.CUSTOMER_COMMUNICATE_ADD.getAlias(), BasicConstant.ONE),
    CONTRACT_PAYMENT(RedundantTemplateTypeEnum.CONTRACT.getCode(),"payment","enum.workFlow.value.contract_payment","new",XbbRefTypeEnum.PAYMENT.getCode(),PlatFormEnum.ALL,ProPermissionAliasEnum.PAYMENT_ADD.getAlias(), BasicConstant.ONE),

    CONTRACT_WRITE_OFF_PREPAYMENT(RedundantTemplateTypeEnum.CONTRACT.getCode(), "writeOffPrepayment", "enum.workFlow.value.contract_write_off_prepayment", "new", XbbRefTypeEnum.WRITE_OFF_PREPAYMENT.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.PAYMENT_SHEET_BAD.getAlias(), BasicConstant.ZERO),
    CONTRACT_PAYMENT_SHEET(RedundantTemplateTypeEnum.CONTRACT.getCode(),"paymentSheet","enum.workFlow.value.contract_payment_sheet","new",XbbRefTypeEnum.PAYMENT_SHEET.getCode(),PlatFormEnum.DINGTALK,ProPermissionAliasEnum.PAYMENT_SHEET_ADD.getAlias(), BasicConstant.ONE),
    CONTRACT_PAYMENT_SHEET_BAD(RedundantTemplateTypeEnum.CONTRACT.getCode(), "paymentSheetBad", "enum.workFlow.value.contract_payment_sheet_bad", "new", XbbRefTypeEnum.BAD_DEBT.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.PAYMENT_SHEET_BAD.getAlias(), BasicConstant.ZERO),
    CONTRACT_ESIGN(RedundantTemplateTypeEnum.CONTRACT.getCode(), "contractEsign", "enum.workFlow.value.esign", "esign", XbbRefTypeEnum.ESIGN.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.CONTRACT_ESIGN.getAlias(), BasicConstant.ZERO),
    CONTRACT_ESIGN_DOWNLOAD(RedundantTemplateTypeEnum.CONTRACT.getCode(), "contractEsign", "enum.workFlow.value.esign_download", "esignDownload", XbbRefTypeEnum.ESIGN.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.CONTRACT_ESIGN.getAlias(), BasicConstant.ZERO),
    CONTRACT_WORK_ORDER_V2(RedundantTemplateTypeEnum.CONTRACT.getCode(),"workOrderV2","enum.workFlow.value.customer_work_order_v2","new",XbbRefTypeEnum.WORK_ORDER_V2.getCode(),PlatFormEnum.ALL,ProPermissionAliasEnum.WORK_ORDER_V2_ADD.getAlias(), BasicConstant.ONE),

    /**
     * 信用管理
     */
    CREDIT_TEMPORARY(RedundantTemplateTypeEnum.CREDIT_LIMIT.getCode(), "creditTemporary", "enum.workFlow.value.credit_temporary", "new", XbbRefTypeEnum.CREDIT_TEMPORARY_LIMIT.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.CREDIT_TEMPORARY_LIMIT_ADD.getAlias(), BasicConstant.ONE),
    CREDIT_FIXED(RedundantTemplateTypeEnum.CREDIT_LIMIT.getCode(), "creditFixed", "enum.workFlow.value.credit_fixed", "new", XbbRefTypeEnum.CREDIT_FIXED_LIMIT.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.CREDIT_FIXED_LIMIT_ADD.getAlias(), BasicConstant.ONE),

    PAYMENT_PAYMENT_SHEET(RedundantTemplateTypeEnum.PAYMENT.getCode(), "paymentSheet", "enum.workFlow.value.payment_payment_sheet", "new", XbbRefTypeEnum.PAYMENT_SHEET.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.PAYMENT_SHEET_ADD.getAlias(), BasicConstant.ONE),
    /**
     * 资金改造一期，详情页去除红冲操作按钮
     * @author chenshan
     * @Date 2019-11-06 14:09
     */
    PAYMENT_RED(RedundantTemplateTypeEnum.PAYMENT.getCode(), "paymentRed", "enum.workFlow.value.payment_red", "new", XbbRefTypeEnum.RED_RECEIVABLES.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.RED_RECEIVABLES.getAlias(), BasicConstant.ZERO),
    PAYMENT_REVERT(RedundantTemplateTypeEnum.PAYMENT.getCode(), "paymentRevert", "enum.workFlow.value.payment_revert", "set", XbbRefTypeEnum.PAYMENT.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.PAYMENT_DELETE.getAlias(), BasicConstant.ZERO),
    WRITE_OFF_PREPAYMENT(RedundantTemplateTypeEnum.PAYMENT.getCode(), "writeOffPrepayment", "enum.workFlow.value.write_off_prepayment", "new", XbbRefTypeEnum.WRITE_OFF_PREPAYMENT.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.PAYMENT_SHEET_ADD.getAlias(), BasicConstant.ZERO),
    PAYMENT_BAD(RedundantTemplateTypeEnum.PAYMENT.getCode(), "paymentSheetBad", "enum.workFlow.value.payment_bad", "new", XbbRefTypeEnum.BAD_DEBT.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.PAYMENT_SHEET_BAD.getAlias(), BasicConstant.ZERO),
    PAYMENT_INVOICE(RedundantTemplateTypeEnum.PAYMENT.getCode(), "invoice", "enum.workFlow.value.payment_invoice", "new", XbbRefTypeEnum.INVOICE.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.INVOICE_ADD.getAlias(), BasicConstant.ONE),
    //只移动端有（web端用的是 BusinessDetailButtonEnum.PAYMENT_WRITE_OFF）
    PAYMENT_WRITE_OFF(RedundantTemplateTypeEnum.PAYMENT.getCode(), SaasButtonEnum.PAYMENT_WRITE_OFF.getAttr(), SaasButtonEnum.PAYMENT_WRITE_OFF.getValue(), "set", XbbRefTypeEnum.PAYMENT_SHEET.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.PAYMENT_WRITE_OFF.getAlias(), BasicConstant.ZERO),

    PAY_PLAN_PURCHASE_INVOICE(RedundantTemplateTypeEnum.PAY_PLAN.getCode(), "payPlanPurchaseInvoice", "enum.workFlow.value.pay_plan_purchase_invoice", "new", XbbRefTypeEnum.PURCHASE_INVOICE.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.PURCHASE_INVOICE_ADD.getAlias(), BasicConstant.ONE),
    PAY_PLAN_ADD_SHEET(RedundantTemplateTypeEnum.PAY_PLAN.getCode(), "paySheet", "enum.workFlow.value.pay_plan_add_sheet", "new", XbbRefTypeEnum.PAY_SHEET.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.PAY_SHEET_ADD.getAlias(), BasicConstant.ONE),
    PAY_PLAN_BAD(RedundantTemplateTypeEnum.PAY_PLAN.getCode(), "payPlanSheetBad", "enum.workFlow.value.pay_plan_bad", "new", XbbRefTypeEnum.BAD_PAY.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.PAY_SHEET_BAD.getAlias(), BasicConstant.ZERO),
    PAY_PLAN_REVERT(RedundantTemplateTypeEnum.PAY_PLAN.getCode(), "payPlanRevert", "enum.workFlow.value.pay_plan_revert", "set", XbbRefTypeEnum.PAY_PLAN.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.PAY_PLAN_DELETE.getAlias(),BasicConstant.ZERO),
    WRITE_OFF_PREPAY(RedundantTemplateTypeEnum.PAY_PLAN.getCode(), "writeOffPrepay", "enum.workFlow.value.write_off_prepay", "new", XbbRefTypeEnum.WRITE_OFF_PREPAY.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.PAY_SHEET_ADD.getAlias(), BasicConstant.ZERO),

    INVOICE_RED(RedundantTemplateTypeEnum.INVOICE.getCode(), "invoiceRed", "enum.workFlow.value.invoice_red", "new", XbbRefTypeEnum.INVOICE.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.INVOICE_RED.getAlias(), BasicConstant.ZERO),
    INVOICE_CANCEL(RedundantTemplateTypeEnum.INVOICE.getCode(), "invoiceCancel", "enum.workFlow.value.invoice_cancel", "set", XbbRefTypeEnum.INVOICE.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.INVOICE_CANCEL.getAlias(), BasicConstant.ZERO),
    INVOICE_REVERT(RedundantTemplateTypeEnum.INVOICE.getCode(), "invoiceRevert", "enum.workFlow.value.invoice_revert", "set", XbbRefTypeEnum.INVOICE.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.INVOICE_CANCEL.getAlias(), BasicConstant.ZERO),
    //移动端关销项发票详情管理按合同按钮
    INVOICE_LINK_CONTRACT(RedundantTemplateTypeEnum.INVOICE.getCode(),"invoiceLinkContact",SaasButtonEnum.LINK_CONTRACT.getValue(),"linkContract",XbbRefTypeEnum.INVOICE.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.INVOICE_LINK_CONTRACT.getAlias(), BasicConstant.ZERO),


    PURCHASE_INVOICE_RED(RedundantTemplateTypeEnum.PURCHASE_INVOICE.getCode(), "purchaseInvoiceRed", "enum.workFlow.value.purchase_invoice_red", "new", XbbRefTypeEnum.PURCHASE_INVOICE.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.PURCHASE_INVOICE_RED.getAlias(), BasicConstant.ZERO),
    PURCHASE_INVOICE_CANCEL(RedundantTemplateTypeEnum.PURCHASE_INVOICE.getCode(), "purchaseInvoiceCancel", "enum.workFlow.value.purchase_invoice_cancel", "set", XbbRefTypeEnum.PURCHASE_INVOICE.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.PURCHASE_INVOICE_CANCEL.getAlias(), BasicConstant.ZERO),
    PURCHASE_INVOICE_REVERT(RedundantTemplateTypeEnum.PURCHASE_INVOICE.getCode(), "purchaseInvoiceRevert", "enum.workFlow.value.purchase_invoice_revert", "set", XbbRefTypeEnum.PURCHASE_INVOICE.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.PURCHASE_INVOICE_CANCEL.getAlias(), BasicConstant.ZERO),

    // 供应商
    SUPPLIER_COPY(XbbRefTypeEnum.SUPPLIER.getCode(), "supplierCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.SUPPLIER.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.SUPPLIER_ADD.getAlias(), BasicConstant.ZERO),

    SUPPLIER_CONTACT(RedundantTemplateTypeEnum.SUPPLIER.getCode(), "supplierContact", "enum.workFlow.value.supplier_contact", "new", XbbRefTypeEnum.SUPPLIER_CONTACT.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.SUPPLIER_CONTACT_ADD.getAlias(), BasicConstant.ONE),
    SUPPLIER_PUSH_NOTIFY(RedundantTemplateTypeEnum.SUPPLIER.getCode(), "pushNotify", "enum.workFlow.value.supplier_push_notify", "new", XbbRefTypeEnum.PUSH_NOTIFY.getCode(), PlatFormEnum.WEB, null, BasicConstant.ZERO),
    SUPPLIER_PURCHASE(RedundantTemplateTypeEnum.SUPPLIER.getCode(), "addPurchase", "enum.workFlow.value.supplier_purchase", "new", XbbRefTypeEnum.PURCHASE.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.PURCHASE_ADD.getAlias(),BasicConstant.ONE),
    SUPPLIER_PAY_PLAN(RedundantTemplateTypeEnum.SUPPLIER.getCode(), "addPayPlan", "enum.workFlow.value.supplier_pay_plan", "new", XbbRefTypeEnum.PAY_PLAN.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.PAY_PLAN_ADD.getAlias(), BasicConstant.ONE),
    SUPPLIER_PAY_SHEET(RedundantTemplateTypeEnum.SUPPLIER.getCode(), "payPlanSheet", "enum.workFlow.value.supplier_pay_sheet", "new", XbbRefTypeEnum.PAY_SHEET.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.PAY_SHEET_ADD.getAlias(), BasicConstant.ONE),
    SUPPLIER_PURCHASE_INVOICE(RedundantTemplateTypeEnum.SUPPLIER.getCode(),"supplierPurchaseInvoice","enum.workFlow.value.supplier_purchase_invoice","new",XbbRefTypeEnum.PURCHASE_INVOICE.getCode(),PlatFormEnum.ALL,ProPermissionAliasEnum.PURCHASE_INVOICE_ADD.getAlias(),BasicConstant.ONE),

    // 采购合同
    PURCHASE_COPY(XbbRefTypeEnum.PURCHASE.getCode(), "purchaseCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.PURCHASE.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.PURCHASE_ADD.getAlias(), BasicConstant.ZERO),
    PURCHASE_INSTOCK(RedundantTemplateTypeEnum.PURCHASE.getCode(), "instock", "enum.workFlow.value.purchase_instock", "new", XbbRefTypeEnum.PURCHASE_INSTOCK.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.PURCHASE_INSTOCK_ADD.getAlias(), BasicConstant.ONE),
    PURCHASE_INVOICE(RedundantTemplateTypeEnum.PURCHASE.getCode(), "invoice", "enum.workFlow.value.purchase_invoice", "new", XbbRefTypeEnum.PURCHASE_INVOICE.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.PURCHASE_INVOICE_ADD.getAlias(), BasicConstant.ONE),
    PURCHASE_RETURNED(RedundantTemplateTypeEnum.PURCHASE.getCode(), "returnPurchase", "enum.workFlow.value.purchase_returned", "new", XbbRefTypeEnum.RETURNED_PURCHASE.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.RETURN_PURCHASE_ADD.getAlias(), BasicConstant.ONE),
    PURCHASE_PAY_PLAN(RedundantTemplateTypeEnum.PURCHASE.getCode(), "payPlan", "enum.workFlow.value.purchase_pay_plan", "new", XbbRefTypeEnum.PAY_PLAN.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.PAY_PLAN_ADD.getAlias(), BasicConstant.ONE),
    PURCHASE_PAY_SHEET(RedundantTemplateTypeEnum.PURCHASE.getCode(), "payPlanSheet", "enum.workFlow.value.purchase_pay_sheet", "new", XbbRefTypeEnum.PAY_SHEET.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.PAY_SHEET_ADD.getAlias(), BasicConstant.ONE),
    PURCAHASE_WRITE_OFF_PREPAY(RedundantTemplateTypeEnum.PURCHASE.getCode(), "writeOffPrepay", "enum.workFlow.value.purcahase_write_off_prepay", "new", XbbRefTypeEnum.WRITE_OFF_PREPAY.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.PAY_SHEET_ADD.getAlias(), BasicConstant.ZERO),
    PURCAHASE_PAY_SHEET_BAD(RedundantTemplateTypeEnum.PURCHASE.getCode(), "paySheetBad", "enum.workFlow.value.purcahase_pay_sheet_bad", "new", XbbRefTypeEnum.BAD_PAY.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.PAY_SHEET_ADD.getAlias(), BasicConstant.ZERO),
    PURCHASE_REMIND(RedundantTemplateTypeEnum.PURCHASE.getCode(), "remind", "enum.workFlow.value.purchase_remind", "new", XbbRefTypeEnum.SUPPLIER_COMMUNICATE.getCode(), PlatFormEnum.WEB, ProPermissionAliasEnum.SUPPLIER_COMMUNICATE_ADD.getAlias(), BasicConstant.ONE),
    PURCHASE_PUSH_NOTIFY(RedundantTemplateTypeEnum.PURCHASE.getCode(), "pushNotify", "enum.workFlow.value.purchase_push_notify", "new", XbbRefTypeEnum.PUSH_NOTIFY.getCode(), PlatFormEnum.WEB, null, BasicConstant.ZERO ),
    PURCHASE_ESIGN(RedundantTemplateTypeEnum.PURCHASE.getCode(), "purchaseEsign", "enum.workFlow.value.esign", "esign", XbbRefTypeEnum.ESIGN.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.PURCHASE_ESIGN.getAlias(), BasicConstant.ZERO),
    PURCHASE_ESIGN_DOWNLOAD(RedundantTemplateTypeEnum.PURCHASE.getCode(), "purchaseEsign", "enum.workFlow.value.esign_download", "esignDownload", XbbRefTypeEnum.ESIGN.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.PURCHASE_ESIGN.getAlias(), BasicConstant.ZERO),
    // 采购退货
    RETURNED_PURCHASE_OUTSTOCK(RedundantTemplateTypeEnum.RETURNED_PURCHASE.getCode(), "outstock", "enum.workFlow.value.returned_purchase_outstock", "new", XbbRefTypeEnum.RETURNED_PURCHASE_OUTSTOCK.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.RETURNED_PURCHASE_OUTSTOCK_ADD.getAlias(), BasicConstant.ONE),

    // 生产单
    PRODUCTION_ORDER_COPY(XbbRefTypeEnum.PRODUCTION_ORDER.getCode(), "productionOrderCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.PRODUCTION_ORDER.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.PRODUCTION_ORDER_ADD.getAlias(), BasicConstant.ZERO),

    PRODUCTION_ORDER_MATERIEL_OUTSTOCK(RedundantTemplateTypeEnum.PRODUCTIONORDER.getCode(), "materielOutstock", "enum.workFlow.value.production_order_materiel_outstock", "new", XbbRefTypeEnum.PRODUCTION_MATERIEL_OUTSTOCK.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.PRODUCTION_MATERIEL_OUTSTOCK_ADD.getAlias(), BasicConstant.ONE),
    PRODUCTION_ORDER_PRODUCT_INSTOCK(RedundantTemplateTypeEnum.PRODUCTIONORDER.getCode(), "finishedProductInstock", "enum.workFlow.value.production_order_product_instock", "new", XbbRefTypeEnum.PRODUCTION_INSTOCK.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.PRODUCTION_INSTOCK_ADD.getAlias(), BasicConstant.ONE),
    PRODUCTION_ORDER_MATERIEL_INSTOCK(RedundantTemplateTypeEnum.PRODUCTIONORDER.getCode(), "returnedMaterielInstock", "enum.workFlow.value.production_order_materiel_instock", "new", XbbRefTypeEnum.RETURNED_MATERIEL_INSTOCK.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.RETURNED_MATERIEL_INSTOCK_ADD.getAlias(), BasicConstant.ONE),

    // 盘点单
    INVENTORY_INSTOCK(RedundantTemplateTypeEnum.INVENTORY.getCode(), "seeInstock", "enum.workFlow.value.inventory_instock", "new", XbbRefTypeEnum.OTHER_INSTOCK.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.INSTOCK_ADD.getAlias(), BasicConstant.ONE),
    INVENTORY_OUTSTOCK(RedundantTemplateTypeEnum.INVENTORY.getCode(), "seeOutstock", "enum.workFlow.value.inventory_outstock", "new", XbbRefTypeEnum.OTHER_OUTSTOCK.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.OUTSTOCK_ADD.getAlias(), BasicConstant.ONE),

    // 调拨单
    TRANSFER_INSTOCK(RedundantTemplateTypeEnum.TRANSFER.getCode(), "instock", "enum.workFlow.value.transfer_instock", "new", XbbRefTypeEnum.OTHER_INSTOCK.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.INSTOCK_ADD.getAlias(), BasicConstant.ONE),
    TRANSFER_OUTSTOCK(RedundantTemplateTypeEnum.TRANSFER.getCode(), "outstock", "enum.workFlow.value.transfer_outstock", "new", XbbRefTypeEnum.OTHER_OUTSTOCK.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.OUTSTOCK_ADD.getAlias(), BasicConstant.ONE),

    // 退货退款单
    REFUND_INSTOCK(RedundantTemplateTypeEnum.REFUND.getCode(), "refundInstock", "enum.workFlow.value.refund_instock", "new", XbbRefTypeEnum.REFUND_INSTOCK.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.REFUND_INSTOCK_ADD.getAlias(), BasicConstant.ONE),

    // BOM单
    BOM_BILL_COPY(XbbRefTypeEnum.BOM_BILL.getCode(), "bomBillCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.BOM_BILL.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.BOM_BILL_ADD.getAlias(), BasicConstant.ZERO),

    BOM_BILL_SET_DEFAULT_VERSION(RedundantTemplateTypeEnum.BOMBILL.getCode(), "defaultVersionSet", "enum.workFlow.value.bom_bill_set_default_version", "set", XbbRefTypeEnum.BOM_BILL.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.BOM_BILL_UPDATE.getAlias(), BasicConstant.ZERO),
    BOM_BILL_UN_SET_DEFAULT_VERSION(RedundantTemplateTypeEnum.BOMBILL.getCode(), "defaultVersionUnSet", "enum.workFlow.value.bom_bill_un_set_default_version", "set", XbbRefTypeEnum.BOM_BILL.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.BOM_BILL_UPDATE.getAlias(), BasicConstant.ZERO),
    /**
     * 工单
     */
    WORK_ORDER_COPY(RedundantTemplateTypeEnum.WORKORDER.getCode(), "workOrderCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.WORK_ORDER.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.WORK_ORDER_ADD.getAlias(), BasicConstant.ZERO),
    WORK_ORDER_PRINT(RedundantTemplateTypeEnum.WORKORDER.getCode(), "workOrderPrint", "enum.workFlow.value.print", "print", XbbRefTypeEnum.WORK_ORDER.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.WORK_ORDER_PRINT.getAlias(), BasicConstant.ZERO),
    WORK_ORDER_ACCEPTED(RedundantTemplateTypeEnum.WORKORDER.getCode(), "accept", "enum.workFlow.value.work_order_accepted", "set", XbbRefTypeEnum.WORK_ORDER.getCode(), PlatFormEnum.WEB, ProPermissionAliasEnum.WORK_ORDER.getAlias(), BasicConstant.ZERO),
    WORK_ORDER_COMPLETE(RedundantTemplateTypeEnum.WORKORDER.getCode(), "complete", "enum.workFlow.value.work_order_complete", "set", XbbRefTypeEnum.WORK_ORDER.getCode(), PlatFormEnum.WEB, ProPermissionAliasEnum.WORK_ORDER.getAlias(), BasicConstant.ZERO),
    WORK_ORDER_TRANSFER(RedundantTemplateTypeEnum.WORKORDER.getCode(), "transfer", "enum.workFlow.value.work_order_transfer", "set", XbbRefTypeEnum.WORK_ORDER.getCode(), PlatFormEnum.WEB, ProPermissionAliasEnum.WORK_ORDER.getAlias(), BasicConstant.ZERO),
    WORK_ORDER_CLOSE(RedundantTemplateTypeEnum.WORKORDER.getCode(), "close", "enum.workFlow.value.work_order_close", "set", XbbRefTypeEnum.WORK_ORDER.getCode(), PlatFormEnum.WEB, ProPermissionAliasEnum.WORK_ORDER.getAlias(), BasicConstant.ZERO),
    WORK_ORDER_RESTART(RedundantTemplateTypeEnum.WORKORDER.getCode(), "restart", "enum.workFlow.value.work_order_restart", "set", XbbRefTypeEnum.WORK_ORDER.getCode(), PlatFormEnum.WEB, ProPermissionAliasEnum.WORK_ORDER.getAlias(), BasicConstant.ZERO),
    WORK_ORDER_ROLLBACK(RedundantTemplateTypeEnum.WORKORDER.getCode(), "rollback", "enum.workFlow.value.work_order_rollback", "set", XbbRefTypeEnum.WORK_ORDER.getCode(), PlatFormEnum.WEB, ProPermissionAliasEnum.WORK_ORDER.getAlias(), BasicConstant.ZERO),
    WORK_ORDER_OUTSTOCK(RedundantTemplateTypeEnum.WORKORDER.getCode(), "workOrderOutstock", "enum.workFlow.value.work_order_outstock", "new", XbbRefTypeEnum.WORK_ORDER_OUTSTOCK.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.WORK_ORDER_OUTSTOCK_ADD.getAlias(), BasicConstant.ONE),

    WORK_ORDER_DETAIL_EDIT(RedundantTemplateTypeEnum.WORKORDER.getCode(), "edit", "enum.workFlow.value.work_order_detail_edit", "edit", XbbRefTypeEnum.WORK_ORDER.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.WORK_ORDER_UPDATE.getAlias(), BasicConstant.ZERO),
    WORK_ORDER_DETAIL_DEL(RedundantTemplateTypeEnum.WORKORDER.getCode(), "delete", "enum.workFlow.value.work_order_detail_del", "delete", XbbRefTypeEnum.WORK_ORDER.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.WORK_ORDER_DELETE.getAlias(), BasicConstant.ZERO),

    //报价单
    QUOTATION_COPY(RedundantTemplateTypeEnum.QUOTATION.getCode(), "quotationCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.QUOTATION.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.QUOTATION_ADD.getAlias(), BasicConstant.ZERO),
    QUOTATION_PUSH_NOTIFY(RedundantTemplateTypeEnum.QUOTATION.getCode(), "pushNotify", "enum.workFlow.value.quotation_push_notify", "new", XbbRefTypeEnum.PUSH_NOTIFY.getCode(), PlatFormEnum.WEB, null, BasicConstant.ZERO),
    QUOTATION_REMIND(RedundantTemplateTypeEnum.QUOTATION.getCode(), "remind", "enum.workFlow.value.quotation_remind", "new", XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getCode(), PlatFormEnum.WEB, ProPermissionAliasEnum.CUSTOMER_COMMUNICATE_ADD.getAlias(), BasicConstant.ONE),
    QUOTATION_NEW_VERSION(RedundantTemplateTypeEnum.QUOTATION.getCode(), "newVersion", "enum.workFlow.value.quotation_new_version", "newVersion", XbbRefTypeEnum.QUOTATION.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.QUOTATION_NEW_VERSION.getAlias(), BasicConstant.ZERO),
    QUOTATION_ARCHIVED(RedundantTemplateTypeEnum.QUOTATION.getCode(), "archived", "enum.workFlow.value.quotation_archived", "set", XbbRefTypeEnum.QUOTATION.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.QUOTATION_UPDATE.getAlias(), BasicConstant.ZERO),
    QUOTATION_CANCEL_ARCHIVED(RedundantTemplateTypeEnum.QUOTATION.getCode(), "cancelArchived", "enum.workFlow.value.quotation_cancel_archived", "set", XbbRefTypeEnum.QUOTATION.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.QUOTATION_UPDATE.getAlias(), BasicConstant.ZERO),
    QUOTATION_CONTRACT(RedundantTemplateTypeEnum.QUOTATION.getCode(), "contract", "enum.workFlow.value.quotation_contract", "new", XbbRefTypeEnum.CONTRACT.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.CONTRACT_ADD.getAlias(), BasicConstant.ONE),
    QUOTATION_ESIGN(RedundantTemplateTypeEnum.QUOTATION.getCode(), "quotationEsign", "enum.workFlow.value.esign", "esign", XbbRefTypeEnum.ESIGN.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.QUOTATION_ESIGN.getAlias(), BasicConstant.ZERO),
    QUOTATION_ESIGN_DOWNLOAD(RedundantTemplateTypeEnum.QUOTATION.getCode(), "quotationEsign", "enum.workFlow.value.esign_download", "esignDownload", XbbRefTypeEnum.ESIGN.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.QUOTATION_ESIGN.getAlias(), BasicConstant.ZERO),
    //回款单详情
    PAYMENT_SHEET_INVOICE(RedundantTemplateTypeEnum.PAYMENT_SHEET.getCode(), "invoice", "enum.workFlow.value.payment_sheet_invoice", "new", XbbRefTypeEnum.INVOICE.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.INVOICE_ADD.getAlias(), BasicConstant.ONE),
    //移动端回款单详情（web端处理方式与移动端不一致，web端这种按钮是在BusinessDetailButtonEnum内维护）
    PAYMENT_SHEET_RED(RedundantTemplateTypeEnum.PAYMENT_SHEET.getCode(), SaasButtonEnum.RED.getAttr(), SaasButtonEnum.RED.getValue(), "new", XbbRefTypeEnum.RED_PAYMENT_SHEET.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.PAYMENT_SHEET_RED.getAlias(), BasicConstant.ZERO),
    PAYMENT_SHEET_RED_BALANCE(RedundantTemplateTypeEnum.PAYMENT_SHEET.getCode(), SaasButtonEnum.RED_BALANCE.getAttr(), SaasButtonEnum.RED_BALANCE.getValue(), "new", XbbRefTypeEnum.RED_WRITE_OFF_BALANCE.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.PAYMENT_SHEET_RED.getAlias(), BasicConstant.ZERO),

    //付款单详情
    PAY_SHEET_INVOICE(RedundantTemplateTypeEnum.PAY_SHEET.getCode(), "invoice", "enum.workFlow.value.pay_sheet_invoice", "new", XbbRefTypeEnum.PURCHASE_INVOICE.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.PURCHASE_INVOICE_ADD.getAlias(), BasicConstant.ONE),
    //移动端付款单详情（web端处理方式与移动端不一致，web端这种按钮是在BusinessDetailButtonEnum内维护）
    PAY_SHEET_RED(RedundantTemplateTypeEnum.PAY_SHEET.getCode(), SaasButtonEnum.RED.getAttr(), SaasButtonEnum.RED.getValue(), "new", XbbRefTypeEnum.RED_WRITE_OFF_PAY.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.PAY_SHEET_RED.getAlias(), BasicConstant.ZERO),

    //回款计划相关
    PAYMENT_TASK_EDIT(XbbRefTypeEnum.PAYMENT_TASK.getCode(),SaasButtonEnum.EDIT.getAttr(),XbbRefTypeEnum.PAYMENT_TASK.getName(), "edit",XbbRefTypeEnum.PAYMENT_TASK.getCode(),PlatFormEnum.DINGTALK,ProPermissionAliasEnum.PAYMENT_TASK_UPDATE.getAlias(), BasicConstant.ZERO),
    PAYMENT_TASK_DEL(XbbRefTypeEnum.PAYMENT_TASK.getCode(),SaasButtonEnum.DEL.getAttr(),XbbRefTypeEnum.PAYMENT_TASK.getName(), "delete",XbbRefTypeEnum.PAYMENT_TASK.getCode(),PlatFormEnum.DINGTALK,ProPermissionAliasEnum.PAYMENT_TASK_DELETE.getAlias(), BasicConstant.ZERO),

    //移动端其他收入单详情（web端处理方式与移动端不一致，web端这种按钮是在BusinessDetailButtonEnum内维护）
    OTHER_INCOME_RED(RedundantTemplateTypeEnum.OTHER_INCOME.getCode(), SaasButtonEnum.RED.getAttr(), SaasButtonEnum.RED.getValue(), "new", XbbRefTypeEnum.RED_OTHER_INCOME.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.OTHER_INCOME_RED.getAlias(), BasicConstant.ZERO),
    //移动端其他支出单详情（web端处理方式与移动端不一致，web端这种按钮是在BusinessDetailButtonEnum内维护）
    OTHER_EXPENSE_RED(RedundantTemplateTypeEnum.OTHER_EXPENSE.getCode(), SaasButtonEnum.RED.getAttr(), SaasButtonEnum.RED.getValue(), "new", XbbRefTypeEnum.RED_OTHER_EXPENSE.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.OTHER_EXPENSE_RED.getAlias(), BasicConstant.ZERO),

    // 跟进记录
    CUSTOMER_COMMUNICATE_COPY(RedundantTemplateTypeEnum.COMMUNICATE.getCode(), "customerCommunicateCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.CUSTOMER_COMMUNICATE_ADD.getAlias(), BasicConstant.ZERO),

    // 供应商跟进记录
    SUPPLIER_COMMUNICATE_COPY(XbbRefTypeEnum.SUPPLIER_COMMUNICATE.getCode(), "supplierCommunicateCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.SUPPLIER_COMMUNICATE.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.SUPPLIER_COMMUNICATE_ADD.getAlias(), BasicConstant.ZERO),

    // 供应商联系人
    SUPPLIER_CONTACT_COPY(XbbRefTypeEnum.SUPPLIER_CONTACT.getCode(), "supplierContactCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.SUPPLIER_CONTACT.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.SUPPLIER_CONTACT_ADD.getAlias(), BasicConstant.ZERO),


    REFUND_COPY(RedundantTemplateTypeEnum.REFUND.getCode(), "refundCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.REFUND.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.REFUND_ADD.getAlias(), BasicConstant.ZERO),

    COMMUNICATE_PLAN_COPY(RedundantTemplateTypeEnum.COMMUNICATE_PLAN.getCode(), "communicatePlanCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.COMMUNICATE_PLAN.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.COMMUNICATE_PLAN_ADD.getAlias(), BasicConstant.ZERO),

    // 仓库
    WAREHOUSE_COPY(XbbRefTypeEnum.WAREHOUSE.getCode(), "warehouseCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.WAREHOUSE.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.WAREHOUSE_ADD.getAlias(), BasicConstant.ZERO),


    CLUE_COPY(RedundantTemplateTypeEnum.CLUE.getCode(), "clueCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.CLUE.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.CLUE_ADD.getAlias(), BasicConstant.ZERO),
    CLUE_REMIND(RedundantTemplateTypeEnum.CLUE.getCode(), "remind", "enum.workFlow.value.clue_remind", "new", XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getCode(), PlatFormEnum.WEB, ProPermissionAliasEnum.CUSTOMER_COMMUNICATE_ADD.getAlias(), BasicConstant.ONE),
    CLUE_TRANSFORM(RedundantTemplateTypeEnum.CLUE.getCode(), "transform", "enum.workFlow.value.clue_transform", "transform", XbbRefTypeEnum.CLUE.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.CLUE_TRANS_CUSTOMER.getAlias(), BasicConstant.ONE),
    CLUE_ARCHIVED(RedundantTemplateTypeEnum.CLUE.getCode(), "archived", "enum.workFlow.value.clue_archived", "set", XbbRefTypeEnum.CLUE.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.CLUE_ARCHIVE.getAlias(), BasicConstant.ZERO),
    CLUE_CANCEL_ARCHIVED(RedundantTemplateTypeEnum.CLUE.getCode(), "cancelArchived", "enum.workFlow.value.clue_cancel_archived", "set", XbbRefTypeEnum.CLUE.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.CLUE_ARCHIVE.getAlias(), BasicConstant.ZERO),
    CLUE_INVALID(RedundantTemplateTypeEnum.CLUE.getCode(), "clueInvalid", "enum.workFlow.value.clue_invalid", "set", XbbRefTypeEnum.CLUE.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.CLUE_UPDATE.getAlias(), BasicConstant.ZERO),
    CLUE_FOLLOW(RedundantTemplateTypeEnum.CLUE.getCode(), "clueFollow", "enum.workFlow.value.clue_follow", "set", XbbRefTypeEnum.CLUE.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.CLUE_UPDATE.getAlias(), BasicConstant.ZERO),
    CLUE_BACK_SEA(RedundantTemplateTypeEnum.CLUE.getCode(), "backSea", "enum.workFlow.value.clue_back_sea", "set", XbbRefTypeEnum.CLUE_PUBLIC.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.CLUE_BACK.getAlias(), BasicConstant.ONE),

    //市场活动关联新建销售线索
    MARKET_ACTIVITY_CLUE(RedundantTemplateTypeEnum.MARKET_ACTIVITY.getCode(), "marketActivityClue", "enum.workFlow.value.market_activity_clue", "new", XbbRefTypeEnum.CLUE.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.CLUE_ADD.getAlias(), BasicConstant.ONE),
    MARKET_ACTIVITY_COPY(RedundantTemplateTypeEnum.MARKET_ACTIVITY.getCode(), "marketActivityCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.MARKET_ACTIVITY.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.MARKET_ACTIVITY_ADD.getAlias(), BasicConstant.ZERO),

    SALE_MEMBER_ADD(XbbRefTypeEnum.SALE_BUNDLE.getCode(), "saleMemberAdd", "enum.workFlow.value.sale_member_add", "new", XbbRefTypeEnum.SALE_BUNDLE.getCode(), PlatFormEnum.WEB, ProPermissionAliasEnum.SALE_BUNDLE_MEMBER_ADD.getAlias(), BasicConstant.ZERO),

    FULL_DISCOUNT_COUPON_COPY(XbbRefTypeEnum.FULL_DISCOUNT_COUPON.getCode(), "marketCopy","enum.workFlow.value.marketCopy","marketCopy",XbbRefTypeEnum.FULL_DISCOUNT_COUPON.getCode(),PlatFormEnum.DINGTALK, ProPermissionAliasEnum.MARKETING_ACTIVITY_ADD.getAlias(), BasicConstant.ZERO),
    FULL_DISCOUNT_COUPON_EDIT(XbbRefTypeEnum.FULL_DISCOUNT_COUPON.getCode(),"marketEdit","enum.workFlow.value.marketEdit","marketEdit",XbbRefTypeEnum.FULL_DISCOUNT_COUPON.getCode(),PlatFormEnum.DINGTALK, ProPermissionAliasEnum.MARKETING_ACTIVITY_EDIT.getAlias(), BasicConstant.ZERO),
    FULL_DISCOUNT_COUPON_DEL(XbbRefTypeEnum.FULL_DISCOUNT_COUPON.getCode(),"marketDel","enum.workFlow.value.marketDel","marketDel",XbbRefTypeEnum.FULL_DISCOUNT_COUPON.getCode(),PlatFormEnum.DINGTALK,ProPermissionAliasEnum.MARKETING_ACTIVITY_DELETE.getAlias(), BasicConstant.ZERO),
    FULL_DISCOUNT_COUPON_ONLINE(XbbRefTypeEnum.FULL_DISCOUNT_COUPON.getCode(),"marketOnline","enum.workFlow.value.marketOnline","marketOnline",XbbRefTypeEnum.FULL_DISCOUNT_COUPON.getCode(),PlatFormEnum.DINGTALK,ProPermissionAliasEnum.MARKETING_ACTIVITY_ON.getAlias(), BasicConstant.ZERO),
    FULL_DISCOUNT_COUPON_OFFLINE(XbbRefTypeEnum.FULL_DISCOUNT_COUPON.getCode(),"marketOffline","enum.workFlow.value.marketOffline","marketOffline",XbbRefTypeEnum.FULL_DISCOUNT_COUPON.getCode(),PlatFormEnum.DINGTALK,ProPermissionAliasEnum.MARKETING_ACTIVITY_OFF.getAlias(), BasicConstant.ZERO),

    SPECIAL_GOODS_COPY(XbbRefTypeEnum.SPECIAL_GOODS.getCode(), "marketCopy","enum.workFlow.value.marketCopy","marketCopy",XbbRefTypeEnum.SPECIAL_GOODS.getCode(),PlatFormEnum.DINGTALK, ProPermissionAliasEnum.PROMOTION_ACTIVITY_ADD.getAlias(), BasicConstant.ZERO),
    SPECIAL_GOODS_EDIT(XbbRefTypeEnum.SPECIAL_GOODS.getCode(),"marketEdit","enum.workFlow.value.marketEdit","marketEdit",XbbRefTypeEnum.SPECIAL_GOODS.getCode(),PlatFormEnum.DINGTALK, ProPermissionAliasEnum.PROMOTION_ACTIVITY_EDIT.getAlias(), BasicConstant.ZERO),
    SPECIAL_GOODS_DEL(XbbRefTypeEnum.SPECIAL_GOODS.getCode(),"marketDel","enum.workFlow.value.marketDel","marketDel",XbbRefTypeEnum.SPECIAL_GOODS.getCode(),PlatFormEnum.DINGTALK,ProPermissionAliasEnum.PROMOTION_ACTIVITY_DELETE.getAlias(), BasicConstant.ZERO),
    SPECIAL_GOODS_ONLINE(XbbRefTypeEnum.SPECIAL_GOODS.getCode(),"marketOnline","enum.workFlow.value.marketOnline","marketOnline",XbbRefTypeEnum.SPECIAL_GOODS.getCode(),PlatFormEnum.DINGTALK,ProPermissionAliasEnum.PROMOTION_ACTIVITY_ON.getAlias(), BasicConstant.ZERO),
    SPECIAL_GOODS_OFFLINE(XbbRefTypeEnum.SPECIAL_GOODS.getCode(),"marketOffline","enum.workFlow.value.marketOffline","marketOffline",XbbRefTypeEnum.SPECIAL_GOODS.getCode(),PlatFormEnum.DINGTALK,ProPermissionAliasEnum.PROMOTION_ACTIVITY_OFF.getAlias(), BasicConstant.ZERO),

    // 对账单
    REMIND_CONFIRM_STATEMENT(XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getCode(),"remindConfirm","table.pro_permission.name.remindConfirmStatement","remindConfirm",XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getCode(),PlatFormEnum.DINGTALK,ProPermissionAliasEnum.REMIND_CONFIRM_STATEMENT.getAlias(), BasicConstant.ZERO),
    VALET_CONFIRM_STATEMENT(XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getCode(),"valetConfirm","table.pro_permission.name.valetConfirmStatement","valetConfirm",XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getCode(),PlatFormEnum.DINGTALK,ProPermissionAliasEnum.VALET_CONFIRM_STATEMENT.getAlias(), BasicConstant.ZERO),
    REGENERATE_STATEMENT(XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getCode(),"regenerate","table.pro_permission.name.regenerateStatement","regenerate",XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getCode(),PlatFormEnum.DINGTALK,ProPermissionAliasEnum.REGENERATE_STATEMENT.getAlias(), BasicConstant.ZERO),
    ARCHIVE_STATEMENT(XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getCode(),"archived","enum.workFlow.value.clue_archived","set",XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getCode(),PlatFormEnum.DINGTALK,ProPermissionAliasEnum.ARCHIVE_STATEMENT.getAlias(), BasicConstant.ZERO),
    CANCEL_ARCHIVE_STATEMENT(XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getCode(),"cancelArchived","enum.workFlow.value.clue_cancel_archived","set",XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getCode(),PlatFormEnum.DINGTALK,ProPermissionAliasEnum.ARCHIVE_STATEMENT.getAlias(), BasicConstant.ZERO),

    // 经销商
    DISTRIBUTOR_COPY(XbbRefTypeEnum.DISTRIBUTOR_MANAGEMENT.getCode(), "distributorCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.DISTRIBUTOR_ADD.getAlias(), BasicConstant.ZERO),
    DISTRIBUTOR_CONTACT(XbbRefTypeEnum.DISTRIBUTOR_MANAGEMENT.getCode(), "contact", "enum.workFlow.value.customer_contact", "new", XbbRefTypeEnum.CONTACT.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.DISTRIBUTOR_CONTACT_ADD.getAlias(), BasicConstant.ONE),
    DISTRIBUTOR_REMIND(XbbRefTypeEnum.DISTRIBUTOR_MANAGEMENT.getCode(), "remind", "enum.workFlow.value.customer_remind", "new", XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getCode(), PlatFormEnum.WEB, ProPermissionAliasEnum.DISTRIBUTOR_COMMUNICATE_ADD.getAlias(), BasicConstant.ONE),
    DISTRIBUTOR_ORDER(XbbRefTypeEnum.DISTRIBUTOR_MANAGEMENT.getCode(), "order", "enum.workFlow.value.customer_order", "new", XbbRefTypeEnum.CONTRACT.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.ORDER_ADD.getAlias(), BasicConstant.ONE),
    DISTRIBUTOR_INVOICE_EXPRESS(XbbRefTypeEnum.DISTRIBUTOR_MANAGEMENT.getCode(), "invoice", "enum.workFlow.value.customer_invoice", "new", XbbRefTypeEnum.INVOICE.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.INVOICE_ADD.getAlias(), BasicConstant.ONE),
    DISTRIBUTOR_PAYMENT_SHEET(XbbRefTypeEnum.DISTRIBUTOR_MANAGEMENT.getCode(), "paymentSheet", "enum.workFlow.value.customer_payment_sheet", "new", XbbRefTypeEnum.PAYMENT_SHEET.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.PAYMENT_SHEET_ADD.getAlias(), BasicConstant.ONE),
    DISTRIBUTOR_PAYMENT(XbbRefTypeEnum.DISTRIBUTOR_MANAGEMENT.getCode(), "payment", "enum.workFlow.value.customer_payment", "new", XbbRefTypeEnum.PAYMENT.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.DISTRIBUTOR_COMMUNICATE_ADD.getAlias(), BasicConstant.ONE),
    DISTRIBUTOR_CONTACT_COPY(RedundantTemplateTypeEnum.DISTRIBUTOR_CONTACT.getCode(), "distributorContactCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.DISTRIBUTOR_CONTACT.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.DISTRIBUTOR_CONTACT_ADD.getAlias(), BasicConstant.ZERO),

    // 经销商账号
    DISTRIBUTOR_ACCOUNT_ENABLE(XbbRefTypeEnum.DISTRIBUTOR_ACCOUNT.getCode(), "accountEnable", "enum.saasBatch.value.distributor_account_enable", "set", XbbRefTypeEnum.DISTRIBUTOR_ACCOUNT.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.DISTRIBUTOR_ACCOUNT_ENABLE.getAlias(), BasicConstant.ZERO),
    DISTRIBUTOR_ACCOUNT_DISABLE(XbbRefTypeEnum.DISTRIBUTOR_ACCOUNT.getCode(), "accountDisable", "enum.saasBatch.value.distributor_account_disable", "set", XbbRefTypeEnum.DISTRIBUTOR_ACCOUNT.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.DISTRIBUTOR_ACCOUNT_ENABLE.getAlias(), BasicConstant.ZERO),

    //订货单
    ORDER_THROUGH(RedundantTemplateTypeEnum.ORDER.getCode(),"orderThrough","enum.workFlow.value.order_through","orderThrough",XbbRefTypeEnum.ORDER.getCode(),PlatFormEnum.DINGTALK,ProPermissionAliasEnum.ORDER_THROUGH.getAlias(),BasicConstant.ONE),
    ORDER_CANCELLATION(RedundantTemplateTypeEnum.ORDER.getCode(),"orderCancellation","enum.workFlow.value.order_cancellation","orderCancellation",XbbRefTypeEnum.ORDER.getCode(),PlatFormEnum.DINGTALK,ProPermissionAliasEnum.ORDER_CANCELLATION.getAlias(),BasicConstant.ONE),
//     ORDER_COPY(RedundantTemplateTypeEnum.ORDER.getCode(), "orderCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.ORDER.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.ORDER_ADD.getAlias(), BasicConstant.ZERO),
    ORDER_INVOICE(RedundantTemplateTypeEnum.ORDER.getCode(), "invoice", "enum.workFlow.value.order_invoice", "new", XbbRefTypeEnum.INVOICE.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.INVOICE_ADD.getAlias(), BasicConstant.ONE),
    ORDER_RETURN(RedundantTemplateTypeEnum.ORDER.getCode(), "return", "enum.workFlow.value.order_return", "new", XbbRefTypeEnum.REFUND.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.RETURN_ADD.getAlias(), BasicConstant.ONE),
    ORDER_WORK_ORDER(RedundantTemplateTypeEnum.ORDER.getCode(), "workOrder", "enum.workFlow.value.order_work_order", "new", XbbRefTypeEnum.WORK_ORDER.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.WORK_ORDER_ADD.getAlias(), BasicConstant.ONE),
    ORDER_ORDER_OUTSTOCK(RedundantTemplateTypeEnum.ORDER.getCode(), "orderOutstock", "enum.workFlow.value.order_order_outstock", "new", XbbRefTypeEnum.CONTRACT_OUTSTOCK.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.CONTRACT_OUTSTOCK_ADD.getAlias(), BasicConstant.ONE),
    ORDER_PURCHASE(RedundantTemplateTypeEnum.ORDER.getCode(), "purchase", "enum.workFlow.value.order_purchase", "new", XbbRefTypeEnum.PURCHASE.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.PURCHASE_ADD.getAlias(), BasicConstant.ZERO),
    ORDER_REMIND(RedundantTemplateTypeEnum.ORDER.getCode(), "remind", "enum.workFlow.value.order_remind", "new", XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getCode(), PlatFormEnum.WEB, ProPermissionAliasEnum.CUSTOMER_COMMUNICATE_ADD.getAlias(), BasicConstant.ONE),
    ORDER_PAYMENT(RedundantTemplateTypeEnum.ORDER.getCode(),"payment","enum.workFlow.value.order_payment","new",XbbRefTypeEnum.PAYMENT.getCode(),PlatFormEnum.ALL,ProPermissionAliasEnum.PAYMENT_TASK_ADD.getAlias(), BasicConstant.ONE),

    //出库发货单
//    ORDER_OUTSTOCK_COPY(RedundantTemplateTypeEnum.ORDER_OUTSTOCK.getCode(), "outstockCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.ORDER_OUTSTOCK.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.CONTRACT_OUTSTOCK_ADD.getAlias(), BasicConstant.ZERO),
    NORMAL_DELIVERY(RedundantTemplateTypeEnum.ORDER_OUTSTOCK.getCode(), "normalShipping", "enum.workFlow.value.normal_delivery", "normalShipping", XbbRefTypeEnum.ORDER_OUTSTOCK.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.NORMAL_DELIVERY.getAlias(), BasicConstant.ONE),
    ELECTRONIC_ORDER_DELIVERY(RedundantTemplateTypeEnum.ORDER_OUTSTOCK.getCode(), "electronicShipping", "enum.workFlow.value.electronic_order_delivery", "electronicShipping", XbbRefTypeEnum.ORDER_OUTSTOCK.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.ELECTRONIC_ORDER_DELIVERY.getAlias(), BasicConstant.ONE),
    CANCELL_DELIVERY(RedundantTemplateTypeEnum.ORDER_OUTSTOCK.getCode(), "cancellShipping", "enum.workFlow.value.cancell_delivery", "cancellShipping", XbbRefTypeEnum.ORDER_OUTSTOCK.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.CANCELL_DELIVERY.getAlias(), BasicConstant.ONE),
    ELECTRONIC_ORDER_PRINT(RedundantTemplateTypeEnum.ORDER_OUTSTOCK.getCode(), "electronicOrderPrint", "enum.workFlow.value.electronic_order_print","electronicOrderPrint", XbbRefTypeEnum.ORDER_OUTSTOCK.getCode(),PlatFormEnum.DINGTALK,ProPermissionAliasEnum.ELECTRONIC_ORDER_PRINT.getAlias(), BasicConstant.ONE),
    ELECTRONIC_ORDER_REPEAT_PRINT(RedundantTemplateTypeEnum.ORDER_OUTSTOCK.getCode(),"electronicOrderRepeatPrint","enum.workFlow.value.electronic_order_repeat_print","electronicOrderRepeatPrint", XbbRefTypeEnum.ORDER_OUTSTOCK.getCode(), PlatFormEnum.DINGTALK,ProPermissionAliasEnum.ELECTRONIC_ORDER_REPEAT_PRINT.getAlias(), BasicConstant.ONE),

    //退货单
//    RETURN_COPY(RedundantTemplateTypeEnum.RETURN.getCode(), "returnCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.RETURN.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.RETURN_ADD.getAlias(), BasicConstant.ZERO),
    RETURN_INSTOCK(RedundantTemplateTypeEnum.RETURN.getCode(), "returnInstock", "enum.workFlow.value.return_instock", "new", XbbRefTypeEnum.REFUND_INSTOCK.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.REFUND_INSTOCK_ADD.getAlias(), BasicConstant.ONE),
    FUND_TRANSFER_COPY(RedundantTemplateTypeEnum.FUND_TRANSFER.getCode(), "fundTransferCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.FUND_TRANSFER.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.FUND_TRANSFER_ADD.getAlias(), BasicConstant.ZERO),

    // 产品
    PRODUCT_COST_ADJUST_INSTOCK(RedundantTemplateTypeEnum.PRODUCT.getCode(), "productCostAdjustInstock", "enum.workFlow.value.product_cost_adjust_instock", "new", XbbRefTypeEnum.COST_ADJUST.getCode(), PlatFormEnum.WEB, ProPermissionAliasEnum.COST_ADJUST_ADD.getAlias(), BasicConstant.ONE),

    // 工单v2
    /**
     * 无节点限制
     */
    CANCEL(RedundantTemplateTypeEnum.WORK_ORDER_V2.getCode(), "1", "enum.workOrderV2.node.operate.cancel", "set", XbbRefTypeEnum.WORK_ORDER_V2.getCode(), PlatFormEnum.ALL, null, BasicConstant.ONE),
    RESTART(RedundantTemplateTypeEnum.WORK_ORDER_V2.getCode(), "2", "enum.workOrderV2.node.operate.restart", "set", XbbRefTypeEnum.WORK_ORDER_V2.getCode(), PlatFormEnum.ALL, null, BasicConstant.ONE),
    TRANSFER(RedundantTemplateTypeEnum.WORK_ORDER_V2.getCode(), "3", "enum.workOrderV2.node.operate.transfer", "set", XbbRefTypeEnum.WORK_ORDER_V2.getCode(), PlatFormEnum.ALL,null, BasicConstant.ONE),

    /**
     * 指派节点
     */
    DISTRIBUTION(RedundantTemplateTypeEnum.WORK_ORDER_V2.getCode(), "4", "enum.workOrderV2.node.operate.distribution", "set", XbbRefTypeEnum.WORK_ORDER_V2.getCode(), PlatFormEnum.ALL, null, BasicConstant.ONE),
    CHANGE_WORK_ORDER_POOL(RedundantTemplateTypeEnum.WORK_ORDER_V2.getCode(), "5", "enum.workOrderV2.node.operate.change_work_order_pool", "set", XbbRefTypeEnum.WORK_ORDER_V2.getCode(), PlatFormEnum.ALL, null, BasicConstant.ONE),
    SNATCH_ORDERS(RedundantTemplateTypeEnum.WORK_ORDER_V2.getCode(), "6", "enum.workOrderV2.node.operate.snatch_orders", "set", XbbRefTypeEnum.WORK_ORDER_V2.getCode(), PlatFormEnum.ALL, null, BasicConstant.ONE),

    /**
     * 指派节点后
     */
    BACK_TO_WORK_ORDER_POOL(RedundantTemplateTypeEnum.WORK_ORDER_V2.getCode(), "7", "enum.workOrderV2.node.operate.back_to_work_order_pool", "set", XbbRefTypeEnum.WORK_ORDER_V2.getCode(), PlatFormEnum.ALL, null, BasicConstant.ONE),

    /**
     * 工单节点接受环节
     */
    ACCEPT(RedundantTemplateTypeEnum.WORK_ORDER_V2.getCode(), "8", "enum.workOrderV2.node.operate.accept", "set", XbbRefTypeEnum.WORK_ORDER_V2.getCode(), PlatFormEnum.ALL, null, BasicConstant.ONE),
    REFUSE(RedundantTemplateTypeEnum.WORK_ORDER_V2.getCode(), "9", "enum.workOrderV2.node.operate.refuse", "set", XbbRefTypeEnum.WORK_ORDER_V2.getCode(), PlatFormEnum.ALL, null, BasicConstant.ONE),

    /**
     * 工单节点开始环节
     */
    START(RedundantTemplateTypeEnum.WORK_ORDER_V2.getCode(), "10", "enum.workOrderV2.node.operate.start", "set", XbbRefTypeEnum.WORK_ORDER_V2.getCode(), PlatFormEnum.ALL, null, BasicConstant.ONE),
    SIGN_IN(RedundantTemplateTypeEnum.WORK_ORDER_V2.getCode(), "11", "enum.workOrderV2.node.operate.sign_in", "set", XbbRefTypeEnum.WORK_ORDER_V2.getCode(), PlatFormEnum.ALL, null, BasicConstant.ONE),

    /**
     * 工单节点完成环节
     */
    FINISH(RedundantTemplateTypeEnum.WORK_ORDER_V2.getCode(), "12", "enum.workOrderV2.node.operate.finish", "set", XbbRefTypeEnum.WORK_ORDER_V2.getCode(), PlatFormEnum.ALL, null, BasicConstant.ONE),
    SIGN_OUT(RedundantTemplateTypeEnum.WORK_ORDER_V2.getCode(), "13", "enum.workOrderV2.node.operate.sign_out", "set", XbbRefTypeEnum.WORK_ORDER_V2.getCode(), PlatFormEnum.ALL, null, BasicConstant.ONE),
    ADD_RECEIPT(RedundantTemplateTypeEnum.WORK_ORDER_V2.getCode(), "14", "enum.workOrderV2.node.operate.add_receipt", "set", XbbRefTypeEnum.WORK_ORDER_V2.getCode(), PlatFormEnum.ALL, null, BasicConstant.ONE),

    /**
     * 工单节点后一节点
     */
    BACK(RedundantTemplateTypeEnum.WORK_ORDER_V2.getCode(), "15", "enum.workOrderV2.node.operate.back", "set", XbbRefTypeEnum.WORK_ORDER_V2.getCode(), PlatFormEnum.ALL, null, BasicConstant.ONE),

    /**
     * 结算节点
     */
    SETTLEMENT(RedundantTemplateTypeEnum.WORK_ORDER_V2.getCode(), "16", "enum.workOrderV2.node.operate.settlement", "set", XbbRefTypeEnum.WORK_ORDER_V2.getCode(), PlatFormEnum.ALL, null, BasicConstant.ONE),

    /**
     * 回访节点
     */
    VISIT(RedundantTemplateTypeEnum.WORK_ORDER_V2.getCode(), "17", "enum.workOrderV2.node.operate.visit", "set", XbbRefTypeEnum.WORK_ORDER_V2.getCode(), PlatFormEnum.ALL, null, BasicConstant.ONE),

    /**
     * 自由节点
     */
    ASSIGN(RedundantTemplateTypeEnum.WORK_ORDER_V2.getCode(), "18", "enum.workOrderV2.node.operate.assign", "set", XbbRefTypeEnum.WORK_ORDER_V2.getCode(), PlatFormEnum.ALL, null, BasicConstant.ONE),
    FREE_FINISH(RedundantTemplateTypeEnum.WORK_ORDER_V2.getCode(), "19", "enum.workOrderV2.node.operate.free_node_finish", "set", XbbRefTypeEnum.WORK_ORDER_V2.getCode(), PlatFormEnum.ALL, null, BasicConstant.ONE),

    EDIT_RECEIPT(RedundantTemplateTypeEnum.WORK_ORDER_V2.getCode(), "20", "enum.workOrderV2.node.operate.edit_receipt", "set", XbbRefTypeEnum.WORK_ORDER_V2.getCode(), PlatFormEnum.ALL, null, BasicConstant.ONE),
    // 竞争对手
    COMPETITOR_COPY(XbbRefTypeEnum.COMPETITOR.getCode(), "competitorCopy", "enum.workFlow.value.copy", "copy", XbbRefTypeEnum.COMPETITOR.getCode(), PlatFormEnum.DINGTALK, ProPermissionAliasEnum.COMPETITOR_ADD.getAlias(), BasicConstant.ZERO),
    COMPETITOR_LINK_OPPORTUNITY(RedundantTemplateTypeEnum.COMPETITOR.getCode(), "competitorLinkOpportunity", "enum.workFlow.value.competitor_link_opportunity", "linkOpportunity", XbbRefTypeEnum.COMPETITOR_ANALYSIS.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.COMPETITOR_VIEW.getAlias(), BasicConstant.ZERO),
    OPPORTUNITY_LINK_COMPETITOR(RedundantTemplateTypeEnum.SALES_OPPORTUNITY.getCode(), "opportunityLinkCompetitor", "enum.workFlow.value.opportunity_link_competitor", "linkCompetitor", XbbRefTypeEnum.COMPETITOR_ANALYSIS.getCode(), PlatFormEnum.ALL, ProPermissionAliasEnum.COMPETITOR_VIEW.getAlias(), BasicConstant.ZERO),
    ;

    private Integer fromBusinessType;
    private String attr;
    private String value;
    private String btnType;
    private Integer businessType;
    private PlatFormEnum platform;
    private String permission;
    /**
     * 表单相关为1
     */
    private Integer formRelation;

    WorkFlowEnum(Integer fromBusinessType, String attr, String value, String btnType, Integer businessType, PlatFormEnum platform, String permission, Integer formRelation) {
        this.fromBusinessType = fromBusinessType;
        this.businessType = businessType;
        this.attr = attr;
        this.value = value;
        this.btnType = btnType;
        this.platform = platform;
        this.permission = permission;
        this.formRelation = formRelation;
    }

    public static List<WorkFlowEnum> getByBusinessType(Integer businessType) {
        List<WorkFlowEnum> list = new ArrayList<>();
        for (WorkFlowEnum workFlowEnum : values()) {
            boolean webTab = Objects.equals(businessType, workFlowEnum.getFromBusinessType()) &&
                    (Objects.equals(PlatFormEnum.ALL, workFlowEnum.getPlatform()) || Objects.equals(PlatFormEnum.WEB, workFlowEnum.getPlatform()));
            if (webTab) {
                list.add(workFlowEnum);
            }
        }
        return list;
    }

    public static List<WorkFlowEnum> getByBusinessTypeAndPermission(Integer businessType, Set<String> permissions) {
        List<WorkFlowEnum> list = new ArrayList<>();
        for (WorkFlowEnum workFlowEnum : values()) {
            boolean webTab = Objects.equals(businessType, workFlowEnum.getFromBusinessType()) &&
                    (Objects.equals(PlatFormEnum.ALL, workFlowEnum.getPlatform()) || Objects.equals(PlatFormEnum.WEB, workFlowEnum.getPlatform()));
            boolean hasPermission = true;

            if (Objects.nonNull(workFlowEnum.getPermission())) {
                hasPermission = permissions.contains(workFlowEnum.getPermission());
            }
            if (webTab && hasPermission) {
                list.add(workFlowEnum);
            }
        }
        return list;
    }

    /**
     * 获取dingtalk详情页关联新建
     *
     * @param businessType 业务
     * @return List
     * @author GuoJun.HU
     * @date 2019/3/21 15:30
     * @since V1.0
     */
    public static List<WorkFlowEnum> getByBusinessTypeForDingtalk(Integer businessType) {
        List<WorkFlowEnum> list = new ArrayList<>();
        for (WorkFlowEnum workFlowEnum : WorkFlowEnum.values()) {
            boolean dingtalkTab = Objects.equals(businessType, workFlowEnum.getFromBusinessType()) &&
                    (Objects.equals(PlatFormEnum.ALL, workFlowEnum.getPlatform()) || Objects.equals(PlatFormEnum.DINGTALK, workFlowEnum.getPlatform()));
            if (dingtalkTab) {
                list.add(workFlowEnum);
            }
        }
        return list;
    }

    /**
     * 获取dingtalk详情页关联新建
     *
     * @param businessType 业务
     * @return List
     * @author GuoJun.HU
     * @date 2019/3/21 15:30
     * @since V1.0
     */
    public static List<WorkFlowEnum> getByBusinessTypeAndPermissionForDingtalk(Integer businessType, Set<String> permissions) {
        List<WorkFlowEnum> list = new ArrayList<>();
        for (WorkFlowEnum workFlowEnum : WorkFlowEnum.values()) {
            boolean dingtalkTab = Objects.equals(businessType, workFlowEnum.getFromBusinessType()) &&
                    (Objects.equals(PlatFormEnum.ALL, workFlowEnum.getPlatform()) || Objects.equals(PlatFormEnum.DINGTALK, workFlowEnum.getPlatform()));
            boolean hasPermission = true;
            if (Objects.nonNull(workFlowEnum.getPermission())) {
                hasPermission = permissions.contains(workFlowEnum.getPermission());
            }
            if (dingtalkTab && hasPermission) {
                list.add(workFlowEnum);
            }
        }
        return list;
    }

    /**
     * 获取对应businessType的alias
     * @param workFlowEnumList
     * @return
     */
    public static List<String> getAliasIn(List<WorkFlowEnum> workFlowEnumList) {
        // 获取对应businessType的alias
        List<String> aliasIn = new ArrayList<>();
        for (WorkFlowEnum workFlowEnum : workFlowEnumList) {
            if (Objects.isNull(workFlowEnum.getBusinessType())) {
                continue;
            }
            aliasIn.add(XbbRefTypeEnum.getByCode(workFlowEnum.getBusinessType()).getAlias());
        }
        return aliasIn;
    }

    public String getValue() {
        return I18nMessageUtil.getMessage(value);
    }
}
